package com.movie.utils;

import com.movie.bean.BaseBean;

import java.util.Date;

/**
 * @author Liu Jiaquan
 * @Description
 * @date 2024/8/5 12:33
 */
public class BeanUtil {
    public static <T extends BaseBean> void setDefault(T t) {
        if (t.getId() == null) t.setCreateTime(new Date());
        t.setUpdateTime(new Date());
        if (t.getStatus() == null) t.setStatus(0);
    }

    public static <T extends BaseBean> boolean isNew(T t) {
        return t.getId() == null;
    }

}
